<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title><%= typeof title !=='undefined' ? title : "前端服务出现异常"; %></title>

<link rel="stylesheet" href="/assets/stylesheets/style.css">
<script src="/assets/lib/jquery/3.6.0/jquery.min.js"></script>
<script src="/assets/lib/axios/0.26.1/axios.min.js"></script>

<!-- refer: https://www.sweetalert.cn/ -->
<script src="/assets/lib/sweetalert/2.1.2/sweetalert.min.js"></script>

<script src="/assets/javascripts/httpRequestUtils.js"></script>
<script src="/assets/javascripts/localStorageUtils.js"></script>
<script>
    // API地址
    const APIHOST = '<%= global.site.api.prefix %>';
    axios.defaults.baseURL = APIHOST;
</script>
<style>
    /* 字体加载前先隐藏，不然文字会闪一下 */
    html, body { opacity: 0; }
</style>
<script>
    /**
     * 获取用户浏览器指纹
     *
     * refer:
     * - https://fingerprintjs.com/
     * - https://github.com/fingerprintjs/fingerprintjs
     *
     */
    // Initialize the agent at application startup.
    const fpPromise = import('/assets/lib/fingerprintjs/3.3.3/esm.min.js')
        // const fpPromise = import('https://openfpcdn.io/fingerprintjs/v3')
        .then(FingerprintJS => FingerprintJS.load())

    // // Get the visitor identifier when you need it.
    // fpPromise
    //     .then(fp => fp.get())
    //     .then(result => {
    //         // This is the visitor identifier:
    //         const visitorId = result.visitorId
    //         console.log(visitorId)
    //     });

    async function getVisitorId() {
        try {
            return (await fpPromise.then(fp => fp.get())).visitorId;
        } catch (error) {
            return JSON.stringify(navigator.userAgent);
        }
    }
</script>
